Skip to content

Support policy controller operator#33

Merged
JasonPowr merged 3 commits intomainfrom
support-policy-controller-operator
Aug 29, 2025
Merged

Support policy controller operator#33
JasonPowr merged 3 commits intomainfrom
support-policy-controller-operator

Conversation

@JasonPowr
Copy link
Member

@JasonPowr JasonPowr commented Aug 26, 2025

Pr for the release repo also: https://github.com/securesign/releases/pull/154

Summary by Sourcery

Support policy controller operator in structural-tests by adding constants, parsing logic, regex updates, documentation updates, and a new set of acceptance tests.

New Features:

  • Add constants and parsing utilities for policy controller operator images
  • Introduce acceptance test suite for policy controller operator covering operator images, file-based catalog images, and release snapshot validations

Enhancements:

  • Extend RunImage util to accept entrypoint parameters and update existing TAS operator test
  • Expand snapshot image regex to include pco-fbc prefixed keys

Documentation:

  • Update README to reference policy controller operator and add test invocation instructions

Tests:

  • Add new acceptance tests for policy controller operator images, file-based catalog, and snapshot consistency

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 26, 2025

Reviewer's Guide

Introduce support for the policy-controller-operator by extending test constants, adding new image parsing logic and utilities, updating snapshot patterns, adding dedicated acceptance tests for the policy controller operator, and updating README instructions accordingly.

Class diagram for new and updated test structure supporting policy controller operator

classDiagram
    class AcceptanceSuite {
    }
    class OperatorImagesTest {
    }
    class FBCImagesTest {
    }
    class ReleasesImagesTest {
    }
    class TestConstants {
      +POLICY_CONTROLLER_OPERATOR_IMAGE
      +POLICY_CONTROLLER_OPERATOR_TEST_PATH
    }
    class ImageUtils {
      +ParsePolicyControllerOperatorImages()
    }
    AcceptanceSuite <|-- PCOAcceptanceSuite
    PCOAcceptanceSuite : +setup()
    PCOAcceptanceSuite : +teardown()
    PCOAcceptanceSuite : +runPolicyControllerOperatorTests()
    PCOAcceptanceSuite <|-- FBCImagesTest
    PCOAcceptanceSuite <|-- OperatorImagesTest
    PCOAcceptanceSuite <|-- ReleasesImagesTest
    TestConstants <.. PCOAcceptanceSuite
    ImageUtils <.. PCOAcceptanceSuite
Loading

File-Level Changes

Change Details Files
Extend test constants to include policy controller operator keys and paths
  • Add PolicyControllerOperatorImageKey and PolicyControllerOperatorBundleImageKey constants
  • Define new CSV filename and path constants for the policy controller operator bundle
  • Add MandatoryPcoOperatorImageKeys and OtherPCOOperatorImageKeys helper functions
test/support/test_constants.go
Add image parsing support for policy controller operator values
  • Implement ParsePCOperatorImages to extract PCO and other images via regex
  • Initialize separate OperatorMap outputs for policy controller images
test/support/acceptance.go
Update RunImage utility to support custom entrypoints
  • Change RunImage signature to accept entrypoint parameter
  • Pass entrypoint array in ContainerCreate calls
  • Update operator_images_test.go calls to include entrypoint
test/support/image_utils.go
test/acceptance/rhtas/operator_images_test.go
Expand snapshot data regex to recognize policy controller fbc image keys
  • Update imageRegexp to include pco-fbc- prefix in snapshot key matching
test/support/snapshot_map_type.go
Introduce policy controller operator acceptance test suite
  • Add operator_images_test.go to validate PCO image retrieval and hashing
  • Add fbc_images_test.go to verify file-based catalog images
  • Add releases_images_test.go and pco_acceptance_suite_test.go for snapshot and release validations
test/acceptance/policy_controller/operator_images_test.go
test/acceptance/policy_controller/fbc_images_test.go
test/acceptance/policy_controller/releases_images_test.go
test/acceptance/policy_controller/pco_acceptance_suite_test.go
Update README with policy controller operator instructions
  • Add link to policy-controller-operator repository
  • Adjust go test paths for rhtas tests
  • Add instructions to run policy controller operator tests
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • There’s a mismatch between the constant PolicyControllerOperatorImageKey ("policy-controller-operator-image") and the key returned by MandatoryPcoOperatorImageKeys ("policy-controller-image")—you’ll want to unify those names so lookups don’t fail.
  • ParsePCOperatorImages duplicates much of the logic in ParseOperatorImages—consider extracting a shared parsing helper or using a YAML parser instead of a broad regex to reduce duplication.
  • The regex in ParsePCOperatorImages (repository:\s*…[\s\S]+?) is very greedy and brittle; switching to a structured YAML unmarshal for the values.yaml file would be more reliable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a mismatch between the constant PolicyControllerOperatorImageKey ("policy-controller-operator-image") and the key returned by MandatoryPcoOperatorImageKeys ("policy-controller-image")—you’ll want to unify those names so lookups don’t fail.
- ParsePCOperatorImages duplicates much of the logic in ParseOperatorImages—consider extracting a shared parsing helper or using a YAML parser instead of a broad regex to reduce duplication.
- The regex in ParsePCOperatorImages (`repository:\s*…[\s\S]+?`) is very greedy and brittle; switching to a structured YAML unmarshal for the values.yaml file would be more reliable.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@JasonPowr JasonPowr force-pushed the support-policy-controller-operator branch from 748acfd to 861ae5f Compare August 26, 2025 14:28
@JasonPowr JasonPowr force-pushed the support-policy-controller-operator branch from 861ae5f to 98972ac Compare August 29, 2025 10:47
@JasonPowr JasonPowr force-pushed the support-policy-controller-operator branch from 98972ac to c7fc9b3 Compare August 29, 2025 10:56
@JasonPowr JasonPowr merged commit 109c5e3 into main Aug 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants